﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    public class Class1
    {
        //声明委托
        public delegate void AsyncEventHandler();

        //异步方法
        public void Event1()
        {
            Console.WriteLine("Event1 Start");
            System.Threading.Thread.Sleep(4000);
            Console.WriteLine("Event1 End");
        }

        // 同步方法
        public void Event2()
        {
            Console.WriteLine("Event2 Start");
            int i = 1;
            while (i < 1000)
            {
                i = i + 1;
                Console.WriteLine("Event2 " + i.ToString());
            }
            Console.WriteLine("Event2 End");
        }
    }
}
